<template>
  <a-list itemLayout="vertical" :dataSource="roles">
    <a-list-item slot="renderItem" slot-scope="item, index" :key="index">
      <a-list-item-meta :style="{ marginBottom: '0' }">
        <span
          slot="description"
          style="text-align: center; display: block"
        >{{ item.permissionName }}</span>
        <a
          slot="title"
          style="text-align: center; display: block"
          @click="edit(item.permissionId)"
        >{{ item.permissionShowName }}</a>
      </a-list-item-meta>
    </a-list-item>
  </a-list>
</template>

<script>
import { queryTopPermissionList } from '@/api/role'

export default {
  data() {
    return {
      roles: [],
      mdl: {}
    }
  },
  async mounted() {
    const res = await queryTopPermissionList()
    if (res !== undefined) {
      this.roles = res.data
    }
  },
  methods: {
    edit(id) {
      console.log('id', id)
      this.$emit('setFields', id)
    }
  }
}
</script>
